<template>
    <base-breadcrumb :breadcrumb="!isAudit">
        <template>
            <a-card>
                <titleName title="基础信息填写"></titleName>
                <a-form-model
                    ref="ruleForm"
                    :model="form"
                    :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }"
                    :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }"
                >
                    <a-row :gutter="24">
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="所属分公司：" prop="branchComId">
                                <span>{{ form.branchComName }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="所属项目：" prop="branchComId">
                                <span>{{ form.projectName }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="名称：">
                                <span>{{ form.name }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="建筑面积：">
                                <span>{{ form.structureArea }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="合同开工日期：">
                                <span>{{ form.contractStartDate }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="合同竣工日期：">
                                <span>{{ form.contractEndDate }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="当前状态：">
                                <span v-if="form.auditStatus === 'DRAFT'">草稿</span>
                                <span v-if="form.auditStatus === 'SUBMITTED'">已提交</span>
                                <span v-if="form.auditStatus === 'PAST'">通过</span>
                                <span v-if="form.auditStatus === 'REJECTED'">驳回</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="填报人：">
                                <span>{{ form.createName }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="填报时间：">
                                <span>{{ form.createTime }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="24" :sm="24" class="title">合同额（万元）</a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="不含税：">
                                <span>{{ form.contractTaxExclusive }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="增值税：">
                                <span>{{ form.contractAddedValueTax }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="含税：">
                                <span>{{
                                    form.contractTaxExclusive + form.contractAddedValueTax > 0
                                        ? form.contractTaxExclusive + form.contractAddedValueTax
                                        : 0
                                }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="24" :sm="24" class="title">自施合同额（万元）</a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="不含税：">
                                <span>{{ form.roadworkTaxExclusive }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="增值税：">
                                <span>{{ form.roadworkAddedValueTax }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="含税：">
                                <span>{{
                                    form.roadworkTaxExclusive + form.roadworkAddedValueTax > 0
                                        ? form.roadworkTaxExclusive + form.roadworkAddedValueTax
                                        : 0
                                }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="24" :sm="24" class="title">总包结算保底值（万元）</a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="不含税：">
                                <span>{{ form.securityTaxExclusive }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="增值税：">
                                <span>{{ form.securityAddedValueTax }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="含税：">
                                <span>{{
                                    form.securityTaxExclusive + form.securityAddedValueTax > 0
                                        ? form.securityTaxExclusive + form.securityAddedValueTax
                                        : 0
                                }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="24" :sm="24" class="title">总包结算目标值（万元）</a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="不含税：">
                                <span>{{ form.targetTaxExclusive }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="增值税：">
                                <span>{{ form.targetAddedValueTax }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="8" :sm="8">
                            <a-form-model-item label="含税：">
                                <span>{{
                                    form.targetTaxExclusive + form.targetAddedValueTax > 0
                                        ? form.targetTaxExclusive + form.targetAddedValueTax
                                        : 0
                                }}</span>
                            </a-form-model-item>
                        </a-col>
                        <a-col :md="16" :sm="8">
                            <a-form-model-item
                                label="附件："
                                :labelCol="{ lg: { span: 3 }, sm: { span: 5 } }"
                                :wrapperCol="{ lg: { span: 18 }, sm: { span: 17 } }"
                            >
                                <div class="f-col">
                                    <span v-for="(item, index) in form.fileInfoVOList" :key="index">
                                        {{ item.fileName }} &nbsp;
                                        <!-- <a @click="check()">查看</a>&nbsp; -->
                                        <a
                                            :href="
                                                '/api/ycloud-file-center/oper/download?access_token=' +
                                                token +
                                                '&fileId=' +
                                                item.fileId
                                            "
                                            >下载</a
                                        >
                                    </span>
                                </div>
                            </a-form-model-item>
                        </a-col>
                    </a-row>
                </a-form-model>
            </a-card>
            <div class="tool-btns mb20 page-btn-right-top">
                <a-button type="primary" @click="closeForm" v-if="checkVisibleInDetail">关闭</a-button>
            </div>
        </template>
    </base-breadcrumb>
</template>
<script>
import { getProjectSettlement } from '@/api/businessAffairs/revenueAndCost'
import Vue from 'vue'
import { checkVisibleInDetail} from '@/utils/util'
export default {
    name:'a'+Date.now(),
    props: {
        isAudit: {
            // 是否作为审批详情
            type: Boolean,
            default: false,
        },
    },
    data() {
        return {
             checkVisibleInDetail:checkVisibleInDetail(this),
            id: '',
            form: {},
            token: '',
        }
    },
    mounted() {
        this.token = Vue.getAcloudProvider().getAccessToken()
        this.id = this.$route.query.id
        console.log(this.id)
        this.getProjectSettlement()
    },
    methods: {
        // 关闭表单
        closeForm() {
            this.$multiTab.close(this.$route.fullpath)
        },
        getProjectSettlement() {
            let params = {
                id: this.id,
            }
            getProjectSettlement(params).then((res) => {
                this.form = res.data
                console.log(this.form)
            })
        },
    },
}
</script>
<style lang="less" scoped>
@deep: ~'>>>';
.tool-btns {
    display: flex;
    justify-content: flex-end;
    @{deep} .ant-btn + .ant-btn {
        margin-left: 12px;
    }
}
.step-text {
    .ant-steps-item-title {
        width: 168px;
    }
}
.check-box {
    .ant-checkbox-group {
        margin-top: 1.5%;
        display: flex;
        justify-content: space-between;
    }
    .ant-checkbox-group-item {
        position: static !important;
    }
}
.radio-box {
    .ant-radio-wrapper {
        position: static !important;
    }
    .ant-radio-group {
        margin-top: 3% !important;
        display: flex;
    }
}
.title {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    font-weight: bold;
    margin-bottom: 24px;
}

.foot-btn {
    display: flex;
    justify-content: space-between;
}
</style>